# import time
#
# from webdriver_manager.chrome import ChromeDriverManager
# from selenium import  webdriver
# from selenium.webdriver.chrome.service import Service
# from webdriver_manager.chrome import ChromeDriverManager
# from selenium.webdriver.common.by import By
#
# # 1.打开浏览器----驱动管理
# ChromeIns=ChromeDriverManager().install()
# #创建谷歌浏览器驱动对象
# driver=webdriver.Chrome(service=Service(ChromeIns))
# time.sleep(2)
# #2.输入百度网址：https://www.baidu.com（网址一定要完整，不要写成www.baidu.com)
# driver.get("https://www.baidu.com")
# time.sleep(2)
# # 3.找到百度输入框，输入关键词“迪丽热巴”
# driver.find_element(By.CSS_SELECTOR,"#kw").send_keys("迪丽热巴")
# time.sleep(2)
# #5.关闭浏览器
# driver.quit()

import time
# from webdriver_manager.microsoft import EdgeChromiumDriverManager  # 导入Edge驱动管理器
from selenium import webdriver
from selenium.webdriver.edge.service import Service  # 导入Edge的Service
from selenium.webdriver.common.by import By

# 1. 打开Edge浏览器---驱动管理
# EdgeIns = EdgeChromiumDriverManager().install()
EdgeIns = "D:\\webdriver\\msedgedriver.exe"
# 创建Edge浏览器驱动对象
driver = webdriver.Edge(service=Service(EdgeIns))
# time.sleep(2)
# 2. 输入百度网址
driver.get("https://www.baidu.com")
time.sleep(2)

# 3. 找到百度输入框，输入关键词“迪丽热巴”
driver.find_element(By.CSS_SELECTOR, "#chat-textarea").send_keys("迪丽热巴")

# 4.点击百度一下按钮
driver.find_element(By.CSS_SELECTOR,"#chat-submit-button").click()

time.sleep(2)
# 5. 关闭浏览器
driver.quit()


